<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>-</title>
	<link rel="stylesheet" href='<c:url value="/resources/css/main.css"/>' type="text/css" />
	<link rel="stylesheet" type="text/css" href='<c:url value="/resources/easyui/themes/default/easyui.css"/>'/>
	<link rel="stylesheet" type="text/css" href='<c:url value="/resources/easyui/themes/icon.css"/>'/>
	<script type="text/javascript" src='<c:url value="/resources/easyui/jquery-1.4.4.min.js"/>'></script>
	<script type="text/javascript" src='<c:url value="/resources/easyui/jquery.easyui.min.js"/>'></script>
	<script type="text/javascript">
	$(function(){
		$('#cancel').click(function() {
			$('#f')[0].reset();
		});
		
		$('#save').click(function() {
			$.ajax({
				url: "<c:url value='/admin/system/update/service'/>",
				type: "POST",
				dataType: "json",
				data: ({
					passwordEncoder: $('#passwordEncoder').val(),
					authenticationHandler: $('#authenticationHandler').val(),
					applicationTitle: $('#applicationTitle').val(),
					rootAccount: $('#rootAccount').val()
				}),
				success: function(msg) {
					if (msg.result === 'ok') {
						alert('服务设置已经保存');
					}
					else {
						alert('保存失败：\n' + msg.message);
					}
				}
			});
		});
	});
	</script>
</head>
<body id="jive-body">
<div id="main">
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
	<tbody>
		<tr valign="top">
			<td width="99%" id="jive-content">
 				<h1>服务设置</h1>
				<div id="jive-main-content">
					<p>使用下面的表单设置服务信息：</p>

<p/>

<div class="warning">
<table cellpadding="0" cellspacing="0" border="0" >
<tbody>
    <tr>
        <td class="jive-icon-label">
        <b>修改加密器和登录验证器可能会造成用户无法登录</b><br/><br/>
        </td>
    </tr>
    <td valign="top" align="left" colspan="2">
        <span>
        	系统提供内置的密码加密器和登录验证器<br/>
        	StandardPasswordEncoder - 标准的密码加密器，用户密码加密存储<br/>
        	SimpleTestPasswordEncoder - 用户密码明文存储，不建议在实际环境中使用，只作为测试环境使用<br/>
        	StandardAuthenticationHandler - 标准的登录验证器<br/>
        	SimpleTestAuthenticationHandler - 测试用登录验证器，登录名和密码相同即可通过验证<br/><br/>
        	可以扩展开发新的密码加密器和登录验证器。分别实现以下接口：<br/>
        	com.iflytek.uc.authentication.handler.PasswordEncoder<br/>
        	com.iflytek.uc.authentication.handler.AuthenticationHandler<br/><br/>
        	如果修改设置后管理员账户无法登录，可直接修改数据库中系统配置表中的数据，需要应用服务器重新启动后生效。
        </span>
    </td>
</tbody>
</table>
</div>
<br>

<form action="#" id="f" method="post">
	<div class="jive-contentBoxHeader">
		服务设置
	</div>
	<div class="jive-contentBox">
		<table width="80%" cellpadding="3" cellspacing="0" border="0">
		<tr>
			<td nowrap>
				Password Encoder
			</td>
			<td nowrap>
				<input type="text" id="passwordEncoder" value="<c:out value='${passwordEncoder}'/>" size="80" maxlength="255">
			</td>
		</tr>
		<tr>
			<td nowrap>
				Authentication Handler
			</td>
			<td nowrap>
				<input type="text" id="authenticationHandler" value="<c:out value='${authenticationHandler}'/>" size="80" maxlength="255">
			</td>
		</tr>
		<tr><td colspan="2">&nbsp;</td></tr>
		<tr>
			<td nowrap>
				Application Title
			</td>
			<td nowrap>
				<input type="text" id="applicationTitle" value="<c:out value='${applicationTitle}'/>" size="40" maxlength="255">
			</td>
		</tr>
		<tr>
			<td nowrap>
				Root Account
			</td>
			<td nowrap>
				<input type="text" id="rootAccount" value="<c:out value='${rootAccount}'/>" size="40" maxlength="255">
			</td>
		</tr>
		</table>
	</div>
<input type="button" id="save" value="保存设置">
<input type="button" id="cancel" value="取消">
</form>

				</div>
			</td>
		</tr>
	</tbody>
	</table>
</div>
</body>
</html>
